package com.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class MvcConfig implements WebMvcConfigurer {

	public void addViewControllers(ViewControllerRegistry registry) {
		registry.addViewController("/login.html").setViewName("login");
		registry.addViewController("/").setViewName("login");
		registry.addViewController("/wty").setViewName("login");
		registry.addViewController("/cat").setViewName("login");	
	}
	
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(new SessionInterceptor())
		.addPathPatterns("/**")
		.excludePathPatterns("/login.html","/login","/","/css/**","/images/**","/js/**","/my-web-0.0.1/**");
	}
	
	@Bean
	WebMvcConfigurer webMvcConfigurer() {
		return this;
	}
	
}
